<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			//1.定位符
			//^ 开头 ^ming匹配 
			//$ 结尾 ming$
			//\b 边界
			//\B 不是边界
			
			//方式1
			var re1=new RegExp("^ming","gi");
			//方式2（简写）
			var re2=/^ming/gi;
			
			var name="Mingsoft";
			console.log(re2.test(name));
			
			var str2="what2candi2say";
			var re3=/a(\d)b(\d{2})/gi;
			
			document.write(RegExp.input);
			document.write("<br />");
			document.write(RegExp.lastMatch);
			document.write("<br />");
			document.write(RegExp.lastParen);
			document.write("<br />");
			document.write(RegExp.leftContext);
			document.write("<br />");
			document.write(RegExp.rightContext);
			document.write("<br />");
			document.write(re3.global);
			document.write("<br />");
			document.write(re3.ignoreCase);
			document.write("<br />");
			
			var str4="i like hsy";
			var re4=/\w+/g;
			var arr;
			while((arr=re4.exec(str4))!=null){
				document.write(arr.index+"-"+re4.lastIndex+arr+"<br />");
			}
		</script>
	</body>
</html>
